1. Field of the Invention
The present invention relates to a computer program product, system, and method for using file element accesses to select file elements in a file system to defragment.
2. Description of the Related Art
A file system provides a framework for naming and indexing files and arranging them on storage devices, such as an electro-magnetic disk drive, for storage and retrieval. File system functionality can be divided into two components, a user component and a storage component. The user component is responsible for managing files within directories, file path traversals and user access to the file. The storage component of the file system determines where files are physically stored on the storage devices.
In a disk storage system, as the stored files and other objects grow in size, additional storage space is required. Additional space for a file that has increased in size may be allocated at non-contiguous locations to where other blocks of the file are stored. Further, when files or blocks of files are deleted, the freed space may result in blocks for a file being in discontiguous locations. This leads to disk fragmentation of the discontiguous storage of blocks of a single logical object. A file layout that is discontiguous may adversely affect system performance because contiguous logical blocks that are likely to be accessed sequentially may not be stored at contiguous physical locations on the disk, thereby requiring the disk drive read head to seek and rotate the disk head to move to a discontiguous location to read further blocks for a file.
Disk defragmentation describes the process of consolidating fragmented files on the disk surface. A disk defragmenter is a software tool that rearranges and moves blocks of data on the hard disk surface so contiguous logical blocks are at contiguous physical locations on the disk surface to avoid latencies resulting from the drive read head having to seek to a discontiguous location for contiguous logical blocks. Disk management and defragmentation utilities may be bundled with operating system components or available as separate applications.